<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title>新增文件</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/pintuer.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/admin.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/resources/css/jquery.datetimepicker.css"/>
    <script src="${pageContext.request.contextPath}/resources/js/jquery.js"></script>
    <script src="${pageContext.request.contextPath}/resources/js/pintuer.js"></script>
    <script src="${pageContext.request.contextPath}/resources/js/jquery.datetimepicker.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="panel admin-panel margin-top">
    <div class="panel-head" id="add"><strong><span class="icon-pencil-square-o"></span>添加内容</strong></div>
    <div class="body-content">
        <form method="post" class="form-x" action="${pageContext.request.contextPath}/file/upload.do" enctype="multipart/form-data">
            <div class="form-group">
                <div class="label">
                    <label>文件夹：</label>
                </div>
                <div class="field">
                    <select name="folderId" class="input w80" style="line-height:17px;" onchange="changesearch()">
                       <c:forEach items="${folders}" var="folder">
                           <option value="${folder.folderId}">${folder.folderName}</option>
                       </c:forEach>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label>选择文件：</label>
                </div>
                <div class="field">
                    <button class="button bg-main icon-check-square-o" id="addFile" type="button"> 添加一行</button>
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                </div>
                <div class="field" id="myfile">
                    <div><a class="button input-file bg-green" href="javascript:void(0);">+ 浏览文件<input size="100" type="file" name="file" /></a>
                        <a class="button input-file bg-red" href="javascript:void(0);" onclick="del(this)"> 删除</a>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label></label>
                </div>
                <div class="field">
                    <button class="button bg-main icon-check-square-o" type="submit"> 提交</button>
                </div>
            </div>
        </form>
    </div>
</div>
<script type="text/javascript">
    $('#hiredate').datetimepicker({
        format:"Y-m-d h:i",
        lang:'kr',
        step:1
    });

    $("#addFile").click(function(){
        var html='<div><a class="button input-file bg-green" href="javascript:void(0);">+ 浏览文件<input size="100" type="file" name="file" /></a> <a class="button input-file bg-red" onclick="del(this)"> 删除</a><div>'
        $("#myfile").append(html);
    });

    function del(obj){
        obj.parentElement.remove();
    }
</script>
</body>
</html>